Added routeKey option to write function.