cleaned up commented out try-catch blocks
changed a global variable to local variable