Fix indentation and implement rename function