Who has the best code for a balancing (Segway) robot ?

I am building a Balancing Segway type robot.

I have several copies of various persons codes that they
used on their similar projects. I have noticed that they
all use a slightly different strategy to achieve the same
goals.

Some use encoders while most do not. Some use simple
2 axis gyro/acc while some use 2-3 redundant units.

Some are long as 900 lines of code while some are short
as 300 lines.

Some seem to function normally, others only work well enough
to just keep upright and allow a jerky movement.

Does anyone have a recommendation of one that works well?

Thank you, Mizlplix