adding support for loading state aswell