Various fixes and edits