finish the basic function