refactor the create action