refactoring core library.