removed inifinte loop