* Properly counting the result, refactored just a tid bit. More major refactoring is due