Rearranging code, made a main.fst.

The code now compiles and is consistent with the communcation diagram specified in the report