Some input-handling function cleanup.