Fixed a bunch of things to get this working