change display of errors
definition can now be provided through parameter
do some cleaning