get the logic right