Added an install script, fixed bugs found during a run.