Bracketing algorithm basically working now; needs cleanup and perhaps a bit of refactoring.