refactored and finished first_set implementation