Improved solution with use of bind