Adding multiple inputs and other refactorings