implementation of individual gateway, untested, no iterators