Adding save function to form