Update index.js
Merge pull request #2 from pgilad/patch-1

Make the safety checks in a logical order