Add documentation, listeners config and remove duplicate code
Improve documentation