Restructured script based on github comments, added sleeps.