Add some edge cases

Note the last two new cases are fail now.

There are also some cases which I am not sure which is the "right" solution, pls see the comments.
nevermind; I think this makes sense now...