Update modality.js

1. Adjusted some variable names.
2. Made default values private
3. Make DOM call for body tag only once
4. Streamlined some of the code
5. Minor Bug Fixes