Add extractInput function