Handle input