Make the form more compact, add docstrings