Fixed some equations and adjusted the main to work with command line arguments