Moved add_action calls underneath their respective functions