cleanup core code