Updated clearInput function