Added helper functions to class to avoid having to repeat that code.