cleaning up some of the code, fixing the flags to make them more consistent.