changed some variable names
handle command line argv
added debug function