Added some functions to companion class for exercises 3.2 - 3.4