implement quit function.