Merge pull request #4 from fpinter/master

added generate if, fixed use if, made row condition more flexible
added count