Added minimise IP function