Rearranged onMouseWheel function for tidier merge.