fixed errors, implemented while logic