another example sketch, minor refactoring