added dynamic output functionality