NEW: refactored shared javascript into shared.js