Code cleanup part one

Mainly whitespace changes, cleanup of for loop and if statment bracketing, and
shuffling of comments.
Remove unused functions from support.h/cu