Simplified code, DRY-style