Created the functions for the assignement