implemented functionalitet for validating and printing variable and string