Lots of small fixes

Simple syntax error fixes and some other small additions.