added condition for counters. basically, everything for task4 is implemented. needs to be tested