new header and cleaned code