moved packet handling into a separate method to allow testing
added tests for packetHandler() function
vertical whitespace police
relative gauge handling and state tracking between flushes
moved packet handling into a separate method to allow testing