General cleanup of core