moved the create logic to index