advencode: working on main that decides how to encode lines