Compilation and Refinement