Remove trailing whitespace and make indentation consistent

Some places used tabs, others spaces.