add shared logic code