Added a bunch of utility functions.