It works for simple cases, further test needed