Updated bounds checking

Checking the bounds better.