Cleanup and small refactor of activate code