add classes from example, small refactoring