remove comments
function flatten