Sorted out some indentation problems that stopped the script from running properly