Generate nonces for each action, except excludes for now
Use wp_get_referer instead of passing previous URL as query arg
Formatting and spacing
Avoid running hooked function on every page load
Check new nonce
Check new specific nonce
Use wp_get_referer
Only run function when requested
Use wp_get_referer
Check more specific nonce
Move function
Hook into admin_post instead of using a form
Use a specific nonce
Use the more specific nonces in the POST ajax requests
Remove the previous page query param