replaced var for let in some places