Refactored enqueue_script