add rangeAssert function to plotUtils, all range check done in utils; cleanup and reformat code in std