better output handling where possible