opitmize code