add max functionality