Removed deprecated method calls and cleaned up other warning.