More core code cleanup