Added Trim sails function

Also made minor changes in order to compile