refactored + pep8 + unit test for selctor lib
refactor pep8