Refactoring of namespace and lib loading