simplify
add comments
order defs top-down
simpler function for sublists