few changes and add gateway example