Base classes and utils for xsquare.