revised tools. introduced a simpler function in first chapter