Altered iteration so P is reset
Fixed iteration scheme, added width and height input params, chose 'optimal' default params