a bit of refactoring, added comments
removed test print, added example for comments