few optimisations + histogram reduction kernel added