common define and functions