refactoring and removed extra line spaces