added if else block for printout