added output functionality