Cleaned up resolve code; moved error checking to a seperate function.
remove UDP code and deprecated message handler code.