Refactoring

See commit messages for what happened.