move lines that don't need to be in try block