New parsing logic