add some networking support, move input code.