refactoring and console output commenting