changed submit logic