Added storing state of categories
Bug fixes