cleaned up and made tests pass. this actually closes #54