Tweaks to gradle.
Minor code optimizations.