Added new function: state which will return a copy of the state which is currently in use.