db version of FRS; cleanup of maths