Check if function already defined to avoid the function redeclared error.