using out_of_range exception when necessary