Prepare some functions for pairmode