public function convert($amount, $from = null, $to = null, $format = TRUE)
    {
        // Get currencies involved
        $from = $from ?: $this->config('default');
        $to = $to ?: $this->getUserCurrency();

        // Get exchange rates
        $from_rate = $this->getCurrencyProp($from, 'currency_rate');
        $to_rate = $this->getCurrencyProp($to, 'currency_rate');

        // Skip invalid to currency rates
        if ($to_rate === null) {
            return null;
        }

        // Convert amount
        $value = $amount * $to_rate * (1 / $from_rate);

        // Should the result be formatted?
        if ($format === TRUE) {
            return $this->format($value, $to);
        }

        // Return value
        return $value;
    }