refactored some more code; messed up the line endings