split parse into smaller functions