Removed unneeded pieces.
Fixed warnings and errors.