@Override
    public void startElement(final String uri, final String localName, final String tag, final Attributes attributes) throws SAXException {
        if (tag.equals("state")) {
            String stname = attributes.getValue("name");
            double tmes = Double.parseDouble(attributes.getValue("times"));

            State st = I;
            for (int i = 0; i < stname.length(); ++i) {
                st = safeNext(st, stname.charAt(i));
            }

            st.addTimes(tmes);
            st.setName(stname);
            loaded = st;

        }
        if (tag.equals("connection")) {

            Character c = attributes.getValue("char").charAt(0);
            Double d = Double.parseDouble(attributes.getValue("restart"));
            loaded.addRestart(c, d);
        }
        if (tag.equals("hmm")) {
            totalProb = Double.parseDouble(attributes.getValue("prob"));
        }
    }