Removed index out of bounds error