test coverage

minimal changes to code. refactoring on `refactor` branch. tests require mojito, and I put a trimmed down version of 0.6.1 in tests/fixtures.

tests pass on travis, sd job soon.

    Statements   : 83.46% ( 338/405 )
    Branches     : 77.37% ( 147/190 )
    Functions    : 86.67% ( 39/45 )
    Lines        : 83.42% ( 337/404 )