Refactored Join page JS