added base implementation of dynamic reload
Code refactoring.