script is now working, still needs to be cleaned up