Tweaking packet parsing, and added a Log class for debugging