public static function trimReference($reference)
    {
        if (substr($reference, -1) == '.' || substr($reference, -1) == '-') {
            $reference = trim(substr($reference, 0, -1));
        }
        while (preg_match('/(\.0+)$/', $reference, $matches)) {
            $reference = substr($reference, 0, strlen($matches[1]) * -1);
        }
        return $reference;
    }