cleaned code. Working for odd orders, semi working for evens.