Code update and cleanup.