Restored the proper order of operations in the main method.