Implemented total paste count and fixed some bugs