Refactor join-elements