JS Code refactoring

Response management enhanced