ignore .idea directory
handle errors to fs.readdir()
removed unused variables