Add init function to custom objects