refactoring into more methods
more refactoring