removed legacy code
updated sql statement
updated variable names
updated..
included configuration file