compile process completely rewritten