Added some imported functions and added argument parsing to the main script