Refactor

adds tests + fixtures.

cc @calvinfo @gjohnson