Refactor activities.js to be used multiple times