Mix

Quick mix with a couple of fixes and refactoring.