Created a function to ease the form processing and data sanitization