refactor 3sum