cleaned up control flow.