clean up core code