fixed some tail recursion issues during class