Roughly implemented pretty much everything

Some stuff could still be refined or cleaned up