small edits, general refactoring