added while loop and conditional tokens