Xiaobei's miscellaneous classes and functions