Add read_goal function.