Added subroutine to address while loops and test cases for ifs and whiles