Some general cleanup, formatting, and commenting