refactor the precompile method