Added documentation, minor changes to script