Beautify and clarify remaining code.