code clean up and made \r\n work nicer