Restructured to core and test