Updated versions of working code