code refactoring
move code for better visibility