Move submission function to separate script