refactor: cleaning up a controller. move validation logic to the directive