modified to not use select/reject