code refactor for picture spider