This Fixes #754,#755,#656,#828,#823

Simplified the count logic