Just small general fixes and refactoring.