removed tail call optimization