ras parser and generally trying to avoid spaghetti