Aug 1 final working code