Cleaned up some of the nucleus relayering code.