Added debug and KASSERTS as given in grading guidlines