added functions for parsing incoming packets