loop counter without notebook interface, don't use stringstream
Merge branch 'master' into mac