adapting to use with sails