restructured into smaller functions with intention to expand parse