refactor answer compilation