Fix warnings and reformat code a little bit.