changed example threshold to a meaningful value + minor refactoring