work for trivial case, has bug for toggle switch. need to fix
~