added output code to call function main