Simplify options calculation code a bit, and document it

Also add :options key to :debug set for debug printing some of the
intermediate values used in the calculation of the final options map.