removed extraneous debug statement and moved some logic into self-contained function
removed extraneous debug statement and moved some logic into self-contained function

georgegtx/emp3-web,missioncommand/emp3-web,georgegtx/emp3-web,georgegtx/emp3-web,missioncommand/emp3-web,georgegtx/emp3-web,missioncommand/emp3-web,missioncommand/emp3-web