removed getstate function since explicit conversion is both clearer and easier