Providing utility functions (if any missing) that returns the required indices would be easier for maintenance.