Finished Simon code for main