Main part of STwig