Refactored classify.py