Added a count function, with docs and a example.