improved buildPictures.py