Done, passes current tests, will add some new ones.