Updated to include close to production code