Move loadExtensions to own module

Looking to make `main.js` much slimmer. Also helps with testability (unit tests).