Adds derangement calculation to model