updated categories, added error handling, messy version of cosine sim working