Moved exception filter code to its own file.