 		return UIColor(red: CGFloat(arc4random_uniform(1000)) / 1000.0, green: CGFloat(arc4random_uniform(1000)) / 1000.0, blue: CGFloat(arc4random_uniform(1000)) / 1000.0, alpha: 1.0)
 	}
 
+	// MARK: - Public methods
+	public func setNeedsShapeCreation()
+	{
+		needsShapeCreation = true
+		setNeedsDisplay()
+	}
+
 	// MARK: - Drawing methodss
 	public override func drawRect(rect: CGRect)
 	{
 		super.drawRect(rect)
 
+		if needsShapeCreation
+		{
+			createShapes()
+		}
+
 		guard let context = UIGraphicsGetCurrentContext() else { return }
 		for shape in shapeArray
 		{
 			let minDimension = min(bounds.size.width, bounds.size.height)
-			var shapeRect = CGRect(x: shape.relativeFrame.minX * bounds.size.width, y: shape.relativeFrame.minY * bounds.size.height, width: shape.relativeFrame.size.width * minDimension, height: shape.relativeFrame.size.height * minDimension)
-			shapeRect.size.width = min(max(shapeRect.size.width, minShapeSize), maxShapeSize)
-			shapeRect.size.height = min(max(shapeRect.size.height, minShapeSize), maxShapeSize)
+			let width = min(max(shape.relativeFrame.size.width * minDimension, minShapeSize), maxShapeSize)
+			let height = min(max(shape.relativeFrame.size.height * minDimension, minShapeSize), maxShapeSize)
+			let shapeRect = CGRect(x: shape.relativeFrame.minX * bounds.size.width - width / 2.0, y: shape.relativeFrame.minY * bounds.size.height - height / 2.0, width: width, height: height)
 			shape.drawInContext(context, forRect: shapeRect)
 		}
 	}

public class AbstractShapeView: UIView
{
	// MARK: - Private properties
	private var shapeArray: [AbstractShape] = []

	// MARK: - Public properties

		{
			let randomIndex = Int(arc4random_uniform(UInt32(shapeInitializers.count)))
			let shapeInitializer = shapeInitializers[randomIndex]

			let shape = shapeInitializer(relativeFrame: randomRelativeFrame(), color: randomColor())
			shapeArray.append(shape)
		}

		needsShapeCreation = false
	}
	
	private func randomRelativeFrame() -> CGRect
