Cleans up and adds some tests