Added Windows exception handling