Refactor activities api