added timeout to UDP and added try catch to everything