Refactored html media property setting code