Fixed lots of small bugs, it actually seems to work now