Fix many bugs and errors
Clean up a little bit