Improved user-agent parser