refactoring of input to be asynchronous