Fixing copyright headers. EOL at end of file and removing some duplicated code