renaming function, minor refactor