Convert tabs to spaces, parameter declaration fixes, general tidies here and there.