cleaning up and fixing the scripts