- add join_dup helper, cleanup code