Wrote init function.