Detect input better