Refactored js template and component models