improving code quality to enable -Wall with minor discounts

improving code quality to enable -Wall with minor discounts