using functions complicated the code too much, but using the classify function mmade the normal switch loop cleaner