Lots of fixes, some more functionality