complete shared fuction