Added a bunch of helper functions.