added a tie function.