Switches 'sanitize' method to a single recursive function instead of one for arrays and one for non-arrays