clean headers, fixes bugs
more bug fixes