First pass at tail call optimization