Moved input handling into InputState helper class.