Optimize as per TODO (thanks Damien!)