replace prev commit with a much cheaper function