when checking for a flag, use & not ==
remove few tests for variables that never existed (merge error)