Refactored submit functions