split parse into two functions