simplify flag handeling