More work on state copy jquery