Return set to vector and fix bugs in pieces