Code cleanup and documentation for admin-functions.php