CLN: refactor bottleneck into class decorator
BUG: fix median compatibility issues
DOC: comment up some possibly obtuse looking code
CLN: fix up comments