Reorganizing code order
Refactoring and adding tests for $loadControls