created function for calculating new attribute index