refactoring some things