added command line argument checks
code formatting