added mysql functionality and logging