Refactor create logic