Median Class Implementation