Update index.js

changed "self" to "_self", and removed from the places where not needed to check the scope