logic improved