Added all the special cases for the edges

not sure yet if it works