added debug statements to calculate O notation