Refactor into addon format