Added histogram and profit functionality