remove exception flow control and added pep8 indenting