Fixup/refactor

See commit messages