I need to rewrite this in order to use the script