gateway code

Basic gateway code