api.stop() function added