Reworked logic of loading the source
Refactoring