re-factore selector.js