Fixed the error with deleting the states. Added some volume managment