Refactoring core library structure