refactored getInput w/ getValueWithClosingParanthesisIdx