working on specs and refactoring (warning: breaks)