Made the code very generic changed the host determination