Code simplification / Idiomatic dart