Removed unused parameters and added an error/success page function