WIP: all tests pass; I think its in good shape. Needs docs