Numerous fine-tuning and fixes