Fixed warnings and removed unused code.