added groups.py and multi threaded changes