got the thing working
test file passes (still need to actually write tests)