Refactored to use seperate resource for plans and plan