To understand how to rid your horse of obnoxious behaviors, it helps to understand how they develop. So here, then, is a short course in behavior management that will teach you how to develop acceptable behaviors, and how to eliminate troublesome behaviors.
First off, behavior is controlled pretty much by what comes before the behavior (thus triggering it) and by what comes after (which functions as a reward, increasing the likelihood the behavior will happen again, or as a punishment, which will decrease the probability that it will happen again.)
First, let's suppose your horse has developed the habit of stepping into your space when you try to mount him. Most habits don't appear full blown the first time, but rather start small and then gradually become more and more troublesome as time goes by. In this case, perhaps your horse stepped toward you while looking at something to his right, and inadvertently bumped you away from the stirrup (or worse: your foot was already in the stirrup, and he bumped you nearly off your feet, which you managed to avoid by hanging onto the saddle.) So now the inevitable mounting has been delayed by a period of time in which you re-group, get your feet on the ground, and put your left foot in the stirrup. You swing up uneventfully. Two days later, as you put your foot in the stirrup, something startles your horse and he looks to the right, shifting his weight to his left shoulder and stepping sideways with his hind feet. Again you are knocked off balance, and when you have both feet on the ground again, you lead him in a circle back to the mounting block. Another delay. If these or similar events happen a few more times, your horse may simply began to step away from you or push into you as you put your foot in the stirrup, because it results in a delay of your getting on his back, and a delay in getting to the work at hand for the day. Inadvertently, you have taught him a bad habit: You put your foot in the stirrup, then he pushes toward you and you cannot mount. Clever, isn't he?
But look at it as a lesson in behavior management: What happened before you were unable to mount (he looked sideways and moved into you: this wasn't deliberate bad behavior, he was just rebalancing himself), and what happened after: You regained your footing, led him in a circle, then managed to re-mount, but in the meantime creating a considerable delay in the start of work, which can function as a reward for your horse's behavior. What started as a normal reaction to something catching his attention can easily become a habit because of your reaction to the behavior (delay of work).
Let's look at another example: Suppose you apply your leg aids to get your horse to move off or increase his tempo, and he ignores you because he's looking ahead at something he might need to shy from. You do nothing, wait a moment, and ask again, and he ignores you again, because the horses in the next pasture are cavorting around and he's watching them. And you do nothing to reinforce your request. So the next time you squeeze your legs, he again ignores you, you do nothing, and you've taught him to be unresponsive. To make a horse light to the aids, you must always deliver a normal aid, then follow his lack of response with an event, such as a tap or smack with the whip, to make him comply. If you do nothing, you train him to ignore you.