minor refactoring of js to remove rendundancies.  no new features.