Back to working commit. Refactoring to follow later.