Applied some minor erformance optimizations.