Added option box detection. Bug fixes.