added compileWithScope util