Yeah Robert, I'm struggling with similar (though less drastic) problems right now. Getting your dose and distribution right is a PITA.
First thing I would do is grab a .1g scale. I use the American Weigh SC-2KG (
http://www.amazon.com/gp/product/B001RF3XJ2) and it's made a big difference.
Think of it this way. A scale with 1g of variation will register everything from 17.5g to 18.4g as 18g. If you're using that to measure espresso, that means you have an inherent, built-in margin of error for your dose of around 6%. Basically, you could be updosing 1.1g and not even know it!
After you have improved dose consistency, look up the stockfelth moves, nutating tamp, Weiss distribution technique, and all the other fun distribution and tamping methods on this site. There are nearly as many methods as there are baristas, but there are a few rules of thumb.
1) Make sure the coffee is evenly distributed inside the portafilter (IE not all pushed against one side or the other)
2) Make sure the coffee is level in the portafilter before you tamp.
3) Be sure that your tamp is level
4) Don't knock the portafilter. It seems to shake the puck loose from the side of the basket, and leads to side channeling.