Handling state state in pages, fixes #20