Adopted tuempeltaucher's suggestion to add -Wall and fix the warnings