Better input parsing