platform-independent restructuring and code simplification