Some clean up of code and script