Replaced var with const where appropriate