The scalar curvature problem on $S^n$: an approach via Morse theory