changed header and functions