Made the program more modulized.