Refactor / cleanup / fixes.