Directive cleanup and fix save functionality