Cleaned up the getMediaFile method.