Cleanup and fixing deprecation warnings