restored codes slightly