Resize the input box and clean up the code a bit