Rename a document with velocity

Hi im trying to rename a doc with velocity but i’ve got no luck for now.

Here’s my script:

#set ($source = $services.model.resolveDocument(‘Main.Doc_from_Mediawiki.WebHome’))
#set ($renameRequest = $services.refactoring.createRenameRequest($source, ‘newName’))
#set ($discard = $renameRequest.setAutoRedirect(false))

What it does is that it create a Main.Doc_from_Mediawiki.Doc from Mediawiki page instead of Main.newName

EDIT: Turns out it did rename the document but didn’t change the title. Im trying to do both
EDIT2: To change the title $docRef.setTitle('newTitle')

To change the title it was simply $docRef.setTitle('newTitle')