Updated based on Scott's suggestions I havent been able to compile to check for errors.