select() implementation - code reformatting and minor changes.