Better flags handling