updates from train. Text, formulas, added median calc