fixed a few bugs and did more refactoring. drawer and 2d transfer function use same data structure, but there is now a fair amount of redundancy. todo: implement mechanism to guarantee consistency in the structure.l