logic improvement