Improve logic performance