Not sure I understand- can you elaborate, maybe provide some pseudocode?