Refactor make-intent function