New background code (faster)