cleaned up a bit, need to do proper tests next