Merge "Refactor exception handling"