implemented memory clearing for photos so that it doesn't get out of hand