add graceful close support. Closes #14
move mixins to lib/mixins
move delegate to utils.js