Create implicit Main function if PROGRAM omitted

I misread the spec and PROGRAM isn't optional after all. So create a
dummy Main function if it is omitted. Also cleaned up the Init code.