some fixes, code clean up adn comments
state for level three packets revised