Switch complicated module if checks for simpler function

Removes repeated ```$enable-all-modules``` check from every module out into a single function.