Nicer way to do bound checking