Added exit methodwq
Minor code layout changed according to pylint messages