Some modifications to main programs