Added code with printing functions