did some optimizations to the code