Tests and fix bugs and stuff