Clean up the code in classify