Added method to also copy MySQL functions and procedures. Some refactoring