Modified partitioning function to ignore empty dots.