core code cleanup