added template function for autoscreen with hostname guarding