Added logic for classification to Knave script.

Code needs to be cleaned up a little bit still.
Fixed a bug with writing classifications to output
Removed some duplicate code from Knave script.