Added dynamic hostname detection