more explicit casts, warnings enabled,
multitude of minor changes

no functional changes