input stuff is mostly functional