This is the main code to implement the FOMES