updated common function