Replaced harcoded waiting retries with configurable value from retry
params.
Some formatting.