Completed beautify invocation logic