DEBUG mode added for config file
DB transactions added with rollbacks
dbquery logic separated
bug fixes