instead of try/catch nests use if/else nests, less humanly readable but probably make machines happier, commented