add select functionality and threading in master