Restructure core libs