Documentation and bounds checking improvements