more refactoring finished