Fixed warnings and cleaned up unused code
Fixed more warnings