improved the question type algorithm