sorry still borked

added some unit tests
and memoized some things