script working mostly