implementing bins and normalization