Some edits and bugfixes