Use factory pattern for creating packets
Add comments