Refactor tests, add rdmbs funcs, updates to marketstat