Code for safety req 5, code cleanup.