Modify init function and add comments