Reverse order of rectangle shaphes
Cleaned the code a bit and fix the transition on remove