Add function to get offset by index and clean up model attrib setting