implemented spantree