Restructure for proper loading of media files