Refactored and added command line arguments