small changes and optimizations( ??)