create common function