Cleanup and line ending normalization