input directive refactored