(*) Implemented the inner decompostion loop,
(*) Need to clamp the upper bounds,
(*) Need a whole lot more unit tests.