Copy Functions and procedures.

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