implemented improved histogram localisation