took care of the stack overflow