Minor cleanup
Performance optimizations, about 50% faster