Written and tested using RenderMonkey