Added a few general-purpose functions