using let to create DRY code