Fix line endings and function definitions