Scap previous implementation and use select.