My attempt at writing the functions I'm learning about