Added state priors and small bugfixes