Refactored Listener and response.|Added Comments.
Merged Code
Merged Code