Refactored media api