Bug 1016885 - Work in progress with lots of debugging