Improved solution