Updated script based on Amazon's run example