function for parsing