Make all functions end with end, on suggestion of Dani Schmid. Thanks!
Make crop_borders a separate function
Enable anti-aliasing if line smoothing is off
Replace sharp miter joins with round joins