did some cleaning, added option for rasterizing figures