SamplingSizeTracker + Map + test suite

Probably some ugly stuff still left in here, feel free to clean it up post-merge.