renamed count to maximum