small refactor in create function