Code refactoring for module load_sources.js

@tadatuta @tavriaforever @dab