ok, now the script is semi functional