code cleanup.
Refactor of plan creation and editing - done!