move input invalidator into util