got rid of unnecessary scope apply, variable renaming