added index trim functionality