Error for host connection
Refactoring + More error handling