Third draft. Refactoring and styles.