made single thread instead of recreating multiple times