bugfixes, refactoring, mysql commands format changed to avoid prompt for password