bound checking and output format