fixes dependencies; finishes initial flag analysis
code transfer; merged