Contribution from fvs@dbc.dk - added die function where needed, moved around. Thanks, FVS