Prettyfy code from @fabriciocosta to be understandable

Signed-off-by: Juan Martin Runge <jmrunge@gmail.com>
Added variable declaration to avoid variables global leak detection from mocha

Signed-off-by: Juan Martin Runge <jmrunge@gmail.com>