Added code to select cells from a bin for the legalizer