updated with select()