added mutithreading to support mutiple users