Added tests for synchronous control flow and refactored code to use the loader-utils