Remove duplicate code from refactor and new line at end of each file