reorganization of reducedim.jl

Nothing was changed. I just moved stuff around, to make it easier for future maintenance and updates.