rearranged a bit and added some parsing classed