Added one more test. Fixed discovered bug by replacing count function with an optimised one.