some changes to the form and some refactoring