Efficiency improvements and cleanup