More tests and faster implementation

added: more automated tests.
added: a function count that capture the common functionality of most other functions.
enhanced: counting now doesn't use for comprehension and the function len which make almost 2x faster.