Refactor to use findOrCreate() on S3 media.
Fixing issues flagged in code review.
Fix implicitly declared variables.