small script optimization