Cleaned up core code.