add common init function