Check before defining functions

Do not define functions when already defined.