cleaned up code (and fixed host check again)