refractor code and working on the nlp service