modified gateway.rb for journals