Added Count, and a minor bug fixes