Add counter to check if latest task goes to zero
Added docblocks and organized the routes