General tidying
fix crashing bug on last line
more tidying
setup script