Primary working code