Added a tests file and added state unwrapper