Fixed some stuff and added better tests

Also this is really broken