Start of perform_action() function