added max's changes