added new config variables, JDBC url and lastDays; refactored code