Initialization of variables and debug option added. This version is compiling and running successfully.