removed while loops
bug