Add test for #3
Add index-on-create logic