have tried this but unable to get out of loop!