refactor magic numbers
refactor parse errors