conditional added to binHandler, fixing bug which chose indices that didnt satisfy k constraint