Added math and while loop