some refactoring of the form package