Refactored out of Bosun, added tests