Added functions from the first six chapters.