More proper try catch
Code refactoring
Some code refactorings