have to run a few more tests but this should be finished. templated and everything.