Added new count function to the library