Improve create controller function