Rewrote using ghost script.