public static function build(array $options = array(), $sessionBag = null)
    {
        if (is_null($sessionBag)) {
            $sessionBag = new StandaloneSessionBag();
        }

        // Default fonts directory
        $fontsDir = __DIR__ . '/Fonts/';
        $fontFile = isset($options['font']) ? $options['font'] : 'Arimo.ttf';

        // Since $options['font'] can be supplied by a user, the checking for existence must be done
        if (!is_file($fontsDir.$fontFile)) {
            throw new RuntimeException(sprintf('Invalid font path supplied "%s"', $fontFile));
        }

        $paramBag = new ParamBag();
        $paramBag->setWidth(isset($options['width']) ? $options['width'] : 120)
                 ->setHeight(isset($options['height']) ? $options['height'] : 50)
                 ->setPadding(isset($options['padding']) ? $options['padding'] : 3)
                 ->setTransparent(isset($options['transparent']) ? $options['transparent'] : false)
                 ->setBackgroundColor(isset($options['background_color']) ? $options['background_color'] : 0xFFFFFF) // white by default
                 ->setTextColor(isset($options['text_color']) ? $options['text_color'] : 0x3440A0) // blue by default
                 ->setOffset(isset($options['offset']) ? $options['offset'] :  -3)
                 ->setFontFile($fontsDir.$fontFile);

        $image = new ImageGenerator($paramBag);

        if (isset($options['text'])) {
            switch ($options['text']) {
                case 'math':
                    $generator = new Text\Math();
                break;

                case 'number':
                    $generator = new Text\RandomNumber();
                break;

                case 'fixed':
                    $generator = new Text\Fixed();
                break;

                case 'random':
                    $generator = new Text\RandomText();
                break;

                default:
                    throw new LogicException(sprintf('Unknown image generator supplied "%s"', $options['text']));
            }

        } else {

            // That's by default as well
            $generator = new Text\RandomText();
        }

        return new Captcha($image, $generator, new Storage($sessionBag));
    }