Reworked some of the NLP algorithm