Removed echo from functions and replaced with return
Created a function that check for set or empty variables
Tested variables and serialized/unserialized $array