Modified constructor to fit threading paradigm.