Factor out sids variable
Fix out of bounds box