[compile] simplified, restructured code