Reduce variable scopes

Also reduces some boolean logic verbosity.
Remove break after return, it is redundant
JSResolver: read duration as signed integer