try catch blocks replaced by ifs