function implement & some comments