Created function for searching for a topic, added comments to model code