Refactor CAE and update training to include SFO
Add some util funcs
moved to cae branch of SFO
slight tweaks