Update. Added error checking and command line usage.