Reorganize and fix various miscellaneous issues