header and exit functions added.