Fix bugs and stuff

There are still bugs though.