Add init function

I've updated my branch and limited the pr to `init`. (#298)