fixing min/max problems and added histogram func to 1D