Modifed to use 'let' syntax. And single line it style as suggested by Sunit