Refactor for more consistent logic.
Rebuild minified js.