Added guards for limit == 0 not to go remote.
Clean up in build.
Some code optimizations.