http://blog.drikin.com/2011/01/aboutflags2.html