refactoring here and there