Initial work on the count option
count now works and is fully tested