Added TODO!!
While loop simplification, still some bugs