Some helper functions.