Handle input properly