Refactor Activity Engine