added comments and loop that builds gateway hash