Refactor $('#userInput').submit() + bug fixes