some modularity refactoring done.