finish refactoring binned stats
tidy up; docstrings