Improve input submit handling