added output functionality
bug fix
added output functionality