Clean up code a bit and fix a few syntax warnings