Factors controlling oxophilicity and carbophilicity of transition metals and main group metals