Refactor rte directive