grouped legend behaviours into managable functions