[AutoQA] #266: Organize the 'autoqa' script into functions