image and audio loading refactored