added nested threads for expanding