performed some more optimizations