Start to refactor plugin directive