Improved packet handling