fixed most warnings, analyzed.