code cleanup and fixed line endings