[enh] handle endl, quite a big modification for this one
[mod] start to remove dead code