Encapsulated form submission into separate function