logic rep sorted out