Efficiency improvements and fixes