Cleaned up some code in core.