Some more edits, partial bug fixes