slect: converted a function and wrote few utility function required.