added random gitter and fixed figure creation