cleanup patch and simplify adding new inputs