Some more specs, features and minor refactoring.