Improve code and fix submit form