Properly trim input fields