build main structure