improved complex parsing