refactored into separate classifyfragment() method