working block density algorithm implemented