Started writing the functions