Reorganised the program entry point.