Removed Histogram and refactored common code.