From http://www.deluxeblogtips.com/2010/07/custom-post-type-with-categories-post.html