Small cleanup of moved functions and fixes