this will break in case ``$required`` is not defined (which could happen as there is no ``else`` case)