Reapplying realex gateway addition changes

@davidjrice fyi -- I reapplied your changes against most recent master.