Fixed some structural stuff

And a lot of bugs