renaming directives to plans and machines to systems, also reorganizing code