Restructure gateway pattern

Restructure gateway pattern as to #34