fixed cleanInput function