Fixed a bunch of forgotten things and added conversion functions