Modifying program to work better with s3.