changed programme loop