I didn't spend a lot of time looking at the details of your question, but I think the top 3 results of this search on SSC will help you solve the problem. I particularly recommend the article by Jeff Moden.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question