Moved set manipulation into model layer