Added conditional checking for while and if statements.