Reorganize and fix some deprecation errors