cleanup header and functions