Code simplification in utils.dart