Refactor tooling

See commit messages.