updated with max's instructions