adding more documentation and refactoring some code

* documentation refactored
* added code to react then DB is not accessible
* added code to react then Jenkins is not accessible
* some functions return Deferred object