added a more generic input method