new header and code cleanup