Issue #59: Refactoring & adding unit tests for preload.py