Fixed and cleaned some things in FOM algo