The mechanisms underlying the enhanced resolution of atomic force microscopy with functionalized tips