refactor parse into separate methods